package com.example.photo_album.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;
import java.util.HashMap;

@Controller
public class UserController {

    Logger logger = LoggerFactory.getLogger(getClass());
    //用户登录
    @PostMapping(value = "/user/login")
    public String login(@RequestParam("username") String username , @RequestParam("password") String password, HttpSession session, HashMap<String,Object> map){
        System.out.println(username+password);
        if (username.equals("admin@qq.com")&&password.equals("123456")){
            session.setAttribute("loginUser",username);
            return "main";
        }else {
            return "page-login";
        }
    }
}
